#ifndef USER_GUARD__H 
#define USER_MANAGEMENT_GUARD__H

#include "book_management.h"

typedef struct _User {
	    char *name; // user real name
		char *username; //user name
		char *password; //password
		BookArray *books;//the books borrowed
        struct _User *next;
}User;

//new users register with the system
//supply name, user name and password
//return 0 if register successfully
int register_user(const char *name,const char *username,const char *password);

int store_users();
int load_users();

//search for the account by username
//return 0 if found successfully, otherwise return 1
//printf("Sorry, registered unsuccessfully, the username you entered already exists.");
int match(const char *username);

//return 0 if the password is correct, otherwise return 1
//return 2 if librarian log in.
//if 1 printf("Sorry, the usename or the password is incorrect.");
//otherwise printf("Welcome, %s", username);
User *verify(const char *username, const char *password);

//borrow books with id
//printf("borrow successfully.") if borrow successfully, or error code and information
void borrow_book(int id,User *user);

//return books with id
//printf("return successfully.") if return books successfully, or error code and information
void return_book(int id,User *user);

#endif 